<template>
	<view :class="showCheckbox ? 'active item':'item'" @click="goDetail(item)">
		<image :src="getSrc(item.issueImages)" class="pix"></image>
		<view class="right">
			<view class="top">
				<text class="p-name">{{item.partNames[2]}}</text>
				<text style="color: #E62029;">{{getStatus(item.issuesStatus)}}</text>
			</view>
			<text style="font-size: 24rpx;">{{item.faultName}}</text>
			<view class="bottom">
				<text style="font-size: 24rpx;">问题处理人：{{item.handlerUserId}}</text>
				<text v-if="item.issuesStatus == 4 " class="btn" @click.stop="goDetail(item)">重新上传</text>
				<text v-if="item.issuesStatus == 1 " class="btn" @click.stop="goDetail(item)">上传</text>
				<!-- <text v-if="item.issuesStatus == 11 ||item.issuesStatus == 2 " class="btn" @click="goDetail()">上传</text> -->
			</view>
		</view>
	</view>
</template>

<script>
	import $C from '@/common/config.js'

	export default {
		props: {
			item: Object,
			showCheckbox: {
				type: Boolean,
				default: false
			},
			parentTitle: String
		},
		name: "data-checked-item",
		data() {
			return {};
		},
		methods: {
			getSrc(ids) {
				if (ids == null || typeof ids == undefined)
					return
				let idArray = ids.split(',')
				let id = idArray[0]
				if ((typeof id) != undefined && id != '') {
					let _src = $C.baseUrl + '/file/download?fileId=' + id
					return _src
				}
			},
			getStatus(status) {
				switch (status) {
					case 1:
						return '待上传'
						break;
					case 11:
						return '待整改'
						break;
					case 2:
						return '待审核'
						break;
					case 3:
						return '已通过'
						break;
					case 4:
						return '未通过'
						break;
				}
			},
			goDetail(item) {
				let _item = encodeURIComponent(JSON.stringify(item))
				// if (item.checkStatus) {
				// 	//查看详情
				// } else {
				// 	//审核通过
				// }
				let _url = '/pages/idata/question/question_detail/question_detail?item='
				uni.navigateTo({
					url: _url + _item
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.item {
		display: flex;
		flex-direction: row;
		width: 100%;
		margin-top: 40rpx;

		.pix {
			width: 180rpx;
			height: 180rpx;
			border-radius: 10rpx;
		}

		.right {
			width: 425rpx;
			margin-left: 25rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;

			.top {
				display: flex;
				flex-direction: row;
				justify-content: space-between;

			}

			.bottom {
				display: flex;
				flex-direction: row;
				justify-content: space-between;

				.btn {
					display: inline-block;
					text-align: center;
					position: relative;
					color: #FFFFFF;
					font-size: 24rpx;
					height: 56rpx;
					line-height: 56rpx;
					width: 160rpx;
					border-radius: 28rpx;
					background: linear-gradient(0deg, #E93423 0%, #FB6858 100%);
				}
			}

		}
	}

	.active {
		width: 92% !important
	}
	.p-name {
		font-size: 28rpx;
		width: 200rpx;
		overflow: hidden;
		/* #ifndef APP-NVUE */
		white-space: nowrap;
		text-overflow: ellipsis;
		/* #endif */
		/* #ifdef APP-NVUE */
		lines: 1;
		text-overflow: ellipsis;
		/* #endif */
	}
</style>
